home *** CD-ROM | disk | FTP | other *** search
/ Total Network Tools 2002 / NextStepPublishing-TotalNetworkTools2002-Win95.iso / Archive / Misc Servers / Zope.exe / BINARY_INSTALL.PY < prev    next >
Encoding:
Python Source  |  1999-11-29  |  6.0 KB  |  156 lines

  1. ##############################################################################
  2. # Zope Public License (ZPL) Version 1.0
  3. # -------------------------------------
  4. # Copyright (c) Digital Creations.  All rights reserved.
  5. # This license has been certified as Open Source(tm).
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions are
  8. # met:
  9. # 1. Redistributions in source code must retain the above copyright
  10. #    notice, this list of conditions, and the following disclaimer.
  11. # 2. Redistributions in binary form must reproduce the above copyright
  12. #    notice, this list of conditions, and the following disclaimer in
  13. #    the documentation and/or other materials provided with the
  14. #    distribution.
  15. # 3. Digital Creations requests that attribution be given to Zope
  16. #    in any manner possible. Zope includes a "Powered by Zope"
  17. #    button that is installed by default. While it is not a license
  18. #    violation to remove this button, it is requested that the
  19. #    attribution remain. A significant investment has been put
  20. #    into Zope, and this effort will continue if the Zope community
  21. #    continues to grow. This is one way to assure that growth.
  22. # 4. All advertising materials and documentation mentioning
  23. #    features derived from or use of this software must display
  24. #    the following acknowledgement:
  25. #      "This product includes software developed by Digital Creations
  26. #      for use in the Z Object Publishing Environment
  27. #      (http://www.zope.org/)."
  28. #    In the event that the product being advertised includes an
  29. #    intact Zope distribution (with copyright and license included)
  30. #    then this clause is waived.
  31. # 5. Names associated with Zope or Digital Creations must not be used to
  32. #    endorse or promote products derived from this software without
  33. #    prior written permission from Digital Creations.
  34. # 6. Modified redistributions of any form whatsoever must retain
  35. #    the following acknowledgment:
  36. #      "This product includes software developed by Digital Creations
  37. #      for use in the Z Object Publishing Environment
  38. #      (http://www.zope.org/)."
  39. #    Intact (re-)distributions of any official Zope release do not
  40. #    require an external acknowledgement.
  41. # 7. Modifications are encouraged but must be packaged separately as
  42. #    patches to official Zope releases.  Distributions that do not
  43. #    clearly separate the patches from the original work must be clearly
  44. #    labeled as unofficial distributions.  Modifications which do not
  45. #    carry the name Zope may be packaged in any form, as long as they
  46. #    conform to all of the clauses above.
  47. # Disclaimer
  48. #   THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
  49. #   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  50. #   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  51. #   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
  52. #   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  53. #   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  54. #   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  55. #   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  56. #   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  57. #   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  58. #   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  59. #   SUCH DAMAGE.
  60. # This software consists of contributions made by Digital Creations and
  61. # many individuals on behalf of Digital Creations.  Specific
  62. # attributions are listed in the accompanying credits file.
  63. ##############################################################################
  64. """Try to do all of the installation steps.
  65.  
  66. This must be run from the top-level directory of the installation.
  67. \(Yes, this is cheezy.  We'll fix this when we have a chance.
  68.  
  69. """
  70.  
  71. import sys, os, getopt
  72. from do import *
  73.  
  74. def setup(me):
  75.     home=os.path.split(me)[0]
  76.     if not home or home=='.': home=os.getcwd()
  77.     home=os.path.split(home)[0]
  78.     if not home or home=='.': home=os.getcwd()
  79.     sys.path.insert(0, os.path.join(home))
  80.     sys.path.insert(0, os.path.join(home,'inst'))
  81.     return home
  82.  
  83. def main(args):
  84.     me=args[0]
  85.     home=setup(me)
  86.     pcgi=os.path.join(home, 'Zope.cgi')
  87.     usage="""install [options]
  88.  
  89.     where options are:
  90.  
  91.        -p   -- Supply the path to the PCGI resource file.
  92.                This defaults to %s.
  93.                Note that this path must include the file name.
  94.     
  95.        -g   -- Supply the name of the unix group to which
  96.                the user that runs your web server belongs.
  97.                If not specified, the installer will attempt
  98.                to determine the group itself. If no group
  99.                is specified and the installer is unable to
  100.                determine the group, the install will fail.
  101.     
  102.        -u   -- Supply the name of the unix user used to
  103.                run your web server. If not specified, this
  104.                defaults to the userid of the current user,
  105.                or 'nobody' is the current user is root.
  106.     
  107.        -h   -- Show command summary
  108.     """ % (pcgi)
  109.     
  110.     try: options, args = getopt.getopt(sys.argv[1:], 'p:g:hu:')
  111.     except: error(usage, sys.exc_info())
  112.     if args: error('', ('Unexpected arguments', args))
  113.  
  114.     group=user=''
  115.     for k, v in options:
  116.         if k=='-p': pcgi=v
  117.         elif k=='-g': group=v
  118.         elif k=='-u': user=v
  119.         elif k=='-h':
  120.             print usage
  121.             sys.exit()
  122.  
  123.     import compilezpy
  124.     print '-'*78
  125.     import zpasswd; zpasswd.write_access(home, user, group)
  126.     import default_content; default_content.main(home, user, group)
  127.     import make_resource; make_resource.main(home, pcgi, user, group)
  128.     import make_start; make_start.sh(home, user, group)
  129.  
  130.     print '-'*78
  131.     print
  132.     print 'Done!'
  133.  
  134. if __name__=='__main__': main(sys.argv)
  135.